#include <iostream>
 
// 定义匿名namespace
namespace {
    int g_globalVar = 10; // 匿名namespace中的全局变量
 
    void PrivateFunction() {
        std::cout << "This is a private function." << std::endl;
    }
 
    class PrivateClass {
    public:
        void PublicMethod() {
            std::cout << "This is a method of a private class." << std::endl;
        }
    };
}
int g_globalVar = 100; // 全局变量
int main() {
    std::cout << "Global variable value: " << g_globalVar << std::endl;//编译引发ambiguous二义性错误error
 
    PrivateFunction();
 
    PrivateClass pc;
    pc.PublicMethod();
 
    return 0;
}